<template>
	<div>
		<div class="card">
			<div class="categoryTitle">认证身份</div>
			<div class="certificateInfo">
				<div class="select" @click="showPop('reportType')">
					<mt-cell is-link value="请选择">
						<p slot="title"><span class="required">*</span>进鉴类型</p>
						<span :class="{'activeSelect':currentTags.reportType}">{{currentTags.reportType?currentTags.reportType: '请选择'}}</span>
					</mt-cell>
				</div>
			</div>
		</div>
		<div class="card">
			<div class="categoryTitle">法人信息</div>
			<div class="certificateInfo">
				<mt-cell>
					<p slot="title"><span class="required">*</span>姓名</p>
					<mt-field placeholder="请输入" @blur.native.capture="handleBlur('contactName')" :state="userInfoRules.contactNameStatus"
					 v-model="userInfo.contactName"></mt-field>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>身份证号码</p>
					<mt-field placeholder="请输入" v-model="userInfo.cerdId" @blur.native.capture="handleBlur('cerdId')" :state="userInfoRules.cerdIdStatus"></mt-field>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showDate">
					<p slot="title"><span class="required">*</span>证件有效期</p>
					<span :class="{'activeSelect':userInfo.cardDeadline}">{{userInfo.cardDeadline!=""?formateDate(userInfo.cardDeadline): '请选择'}}</span>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>手机</p>
					<mt-field placeholder="请输入" v-model="userInfo.contactPhone" @blur.native.capture="handleBlur('contactPhone')"
					 :state="userInfoRules.contactPhoneStatus"></mt-field>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>邮箱</p>
					<mt-field placeholder="请输入" type="email" v-model="userInfo.contactEmail" @blur.native.capture="handleBlur('contactEmail')"
					 :state="userInfoRules.contactEmailStatus"></mt-field>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showPop('licenseType')">
					<p slot="title"><span class="required">*</span>营业执照类型</p>
					<span :class="{'activeSelect':currentTags.licenseType}">{{currentTags.licenseType?currentTags.licenseType: '请选择'}}</span>
				</mt-cell>
				<mt-cell v-if="userInfo.reportType!='02'">
					<p slot="title"><span class="required">*</span>营业执照</p>
					<mt-field placeholder="请输入" v-model="userInfo.licenceNo" @blur.native.capture="handleBlur('licenceNo')" :state="userInfoRules.licenceNoStatus"></mt-field>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showPop('legalSex')" v-if="userInfo.reportType=='02'">
					<p slot="title"><span class="required">*</span>性别</p>
					<span :class="{'activeSelect':currentTags.legalSex}">{{currentTags.legalSex?currentTags.legalSex: '请选择'}}</span>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showPop('legalOccupation')" v-if="userInfo.reportType=='02'">
					<p slot="title"><span class="required">*</span>社法人职业</p>
					<span :class="{'activeSelect':currentTags.legalOccupation}">{{currentTags.legalOccupation?currentTags.legalOccupation: '请选择'}}</span>
				</mt-cell>

				<!-- <mt-cell v-if="userInfo.reportType=='02'">
					<p slot="title"><span class="required">*</span>社法人职业</p>
					<mt-field placeholder="请输入" @blur.native.capture="handleBlur('legalOccupation')" :state="userInfoRules.legalOccupationStatus"
					 v-model="userInfo.legalOccupation"></mt-field>
				</mt-cell> -->
			</div>
		</div>
		<div class="card">
			<div class="categoryTitle">地址信息（营业地区）</div>
			<div class="certificateInfo">
				<mt-cell is-link value="请选择" @click.native="showPop('provinceId')">
					<p slot="title"><span class="required">*</span>省</p>
					<span :class="{'activeSelect':currentTags.provinceId}">{{currentTags.provinceId?currentTags.provinceId: '请选择'}}</span>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showPop('cityId')">
					<p slot="title"><span class="required">*</span>市</p>
					<span :class="{'activeSelect':currentTags.cityId}">{{currentTags.cityId?currentTags.cityId: '请选择'}}</span>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showPop('countryId')">
					<p slot="title"><span class="required">*</span>区</p>
					<span :class="{'activeSelect':currentTags.countryId}">{{currentTags.countryId?currentTags.countryId: '请选择'}}</span>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>路名</p>
					<mt-field placeholder="请输入" v-model="userInfo.road" @blur.native.capture="handleBlur('road')" :state="userInfoRules.roadStatus"></mt-field>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>门牌号</p>
					<mt-field placeholder="请输入" v-model="userInfo.buildingCode" @blur.native.capture="handleBlur('buildingCode')"
					 :state="userInfoRules.buildingCodeStatus"></mt-field>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>地址</p>
					<mt-field placeholder="请输入" v-model="userInfo.address" @blur.native.capture="handleBlur('address')" :state="userInfoRules.addressStatus"></mt-field>
				</mt-cell>
			</div>
		</div>
		<div class="card">
			<div class="categoryTitle">账户信息</div>
			<div class="certificateInfo">
				<mt-cell>
					<p slot="title"><span class="required">*</span>商户营业名称</p>
					<mt-field placeholder="请输入" v-model="userInfo.busiName" @blur.native.capture="handleBlur('busiName')" :state="userInfoRules.busiNameStatus"></mt-field>
				</mt-cell>
				<!-- 	<mt-cell v-if="userInfo.reportType!='02'" is-link value="请选择" @click.native="showPop('isCompay')">
					<p slot="title"><span class="required">*</span>是否对公账户</p>
					<span :class="{'activeSelect':currentTags.isCompay}">{{currentTags.isCompay?currentTags.isCompay: '请选择'}}</span>
				</mt-cell> -->
				<mt-cell>
					<p slot="title"><span class="required">*</span>开户行支行名称</p>
					<mt-field placeholder="请输入" v-model="userInfo.accBankName" @blur.native.capture="handleBlur('accBankName')" :state="userInfoRules.accBankNameStatus"
					 @change.native.capture="bankNameChange">
					</mt-field>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>开户行账号</p>
					<mt-field placeholder="请输入" v-model="userInfo.cardNoCipher" @blur.native.capture="handleBlur('cardNoCipher')"
					 :state="userInfoRules.cardNoCipherStatus"></mt-field>
				</mt-cell>
				<mt-cell>
					<p slot="title"><span class="required">*</span>开户行姓名</p>
					<mt-field placeholder="请输入" v-model="userInfo.cardName" @blur.native.capture="handleBlur('cardName')" :state="userInfoRules.cardNameStatus"></mt-field>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showPop('mccCode')" v-if="userInfo.reportType=='02'">
					<p slot="title"><span class="required">*</span>行业类别</p>
					<span :class="{'activeSelect':currentTags.mccCode}">{{currentTags.mccCode?currentTags.mccCode: '请选择'}}</span>
				</mt-cell>
				<mt-cell is-link value="请选择" @click.native="showPop('isBusiPlace')" v-if="userInfo.reportType=='02'">
					<p slot="title"><span class="required">*</span>是否有营业场所</p>
					<span :class="{'activeSelect':currentTags.isBusiPlace}">{{currentTags.isBusiPlace?currentTags.isBusiPlace: '请选择'}}</span>
				</mt-cell>
			</div>
		</div>
		<div class="card">
			<div class="categoryTitle">证件证明<span style="color:lightgrey;display: inline-block;margin-left:10px;font-size:12px"><img
					 slot="icon" src="../../../../assets/img/tips.png" style="position: relative;top:3px">单张图片不要超过2M</span></div>
			<div class="certificateInfo uploadImg">
				<div>
					<p><span class="required">*</span>身份证正反面</p>
					<imageUpload :url="uploadImageUrl" :btnTxt="'上传身份证正面图片'" :uploadButton="'photo0'" :maxUploads="1" :defaultList="defaultList1"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
					<imageUpload :url="uploadImageUrl" :btnTxt="'上传身份证反面图片'" :uploadButton="'photo1'" :maxUploads="1" :defaultList="defaultList2"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType!='00'">
					<p><span class="required">*</span>自拍照片(手持身份证)</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo2'" :maxUploads="1" :defaultList="defaultList3"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType=='00'">
					<p><span class="required">*</span>开户许可证</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo8'" :maxUploads="1" :defaultList="defaultList9"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType!='02'">
					<p><span class="required">*</span>营业执照</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo3'" :maxUploads="1" :defaultList="defaultList4"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType!='02'">
					<p><span v-show="userInfo.licenseType!=='0'" class="required">*</span>商务税务登记证</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo4'" :maxUploads="1" :defaultList="defaultList5"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType!='02'">
					<p><span v-show="userInfo.licenseType!=='0'" class="required">*</span>组织机构代码证</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo5'" :maxUploads="1" :defaultList="defaultList6"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div>
					<p><span class="required" v-if="userInfo.reportType=='00'||userInfo.reportType=='01'||userInfo.isBusiPlace==='1'">*</span>门头照片</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo6'" :maxUploads="1" :defaultList="defaultList7"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div>
					<p><span class="required" v-if="userInfo.reportType=='00'||userInfo.reportType=='01'||userInfo.isBusiPlace=='1'">*</span>室内照片</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo7'" :maxUploads="1" :defaultList="defaultList8"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType=='02'">
					<p><span class="required">*</span>辅助证明材料</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo9'" :maxUploads="1" :defaultList="defaultList10"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType=='02'">
					<p><span class="required">*</span>经营商品照片</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo10'" :maxUploads="1" :defaultList="defaultList11"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div class="tips" v-if="userInfo.reportType=='02'">
					<img slot="icon" src="../../../../assets/img/tips.png" style="position: relative;top:3px">以下五张图片最少上传一张
				</div>
				<div v-if="userInfo.reportType=='02'">
					<p>租赁协议</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo16'" :maxUploads="1" :defaultList="defaultList17"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType=='02'">
					<p>产权证明</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo12'" :maxUploads="1" :defaultList="defaultList13"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType=='02'">
					<p>执业资质证照</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo13'" :maxUploads="1" :defaultList="defaultList14"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType=='02'">
					<p>第三方证明</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo14'" :maxUploads="1" :defaultList="defaultList15"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
				<div v-if="userInfo.reportType=='02'">
					<p>其他小微商户证明材料</p>
					<imageUpload :url="uploadImageUrl" :uploadButton="'photo15'" :maxUploads="1" :defaultList="defaultList16"
					 @on-complete="uploadComplete" @on-remove="uploadRemove">
					</imageUpload>
				</div>
			</div>
		</div>
		<mt-popup v-model="popupVisible" popup-transition="popup-fade" position="bottom" class="popupClass">
			<mt-picker :slots="selectLists" :visible-item-count="5" :show-toolbar="true" :ref="selectType" value-key="name">
				<mt-button @click="handleConfirm()" size="large">确认</mt-button>
			</mt-picker>
		</mt-popup>
		<mt-datetime-picker lockScroll="true" @confirm="handleConfirmDate" @cancel="cancelConfirmDate" type="date"
		 year-format="{value} 年" month-format="{value} 月" date-format="{value} 日" v-model="userInfo.cardDeadline" ref="datePicker">
		</mt-datetime-picker>
		<p style="height: 40px;line-height: 40px;padding: 0 10px;"><span class="required">
				<checkbox v-model="userInfo.agree"></checkbox>
			</span>阅读并接受<span style="color:red" @click="showContent">《厦门同安租赁网站注册协议》</span></p>
		<mt-button type="danger" size="large" @click.native="handleCertificate" style="margin:10px 0">实名认证</mt-button>
		<mt-button type="danger" size="large" @click.native="giveUpCertificate" plain>放弃认证</mt-button>
	</div>
</template>

<script>
	import imageUpload from "../../upload/image-upload.vue";
	import Format from "../../libs/Format.js"
	export default {
		components: {
			imageUpload
		},
		data() {
			return {
				popupVisible: false,
				popupDate: false,
				// licenseType: false,
				currentTags: {},
				userInfo: {
					agree: false,
					picList: [],
					reportType: "00",
					contactName: "何本爽",
					cerdId: "420104199012030013",
					contactPhone: "18995534000",
					contactEmail: "939378831@qq.com",
					cardDeadline: "",
					busiName: "银联商务股份有限公司",
					accBankName: "",
					cardNoCipher: "6225880066668888",
					cardName: "何本爽",
					provinceId: "31",
					cityId: "310100",
					countryId: "310105",
					road: "天山路",
					buildingCode: "8号",
					address: "上海市上海市长宁区天山路8号",
					licenseType: "",
					licenceNo: "666666666666666"
				},
				// 				userInfo: {
				// 					reportType: "00",
				// 					contactName: "",
				// 					cerdId: "",
				// 					cardDeadline: "",
				// 					contactPhone: "",
				// 					contactEmail: "",
				// 					licenseType: "",
				// 					provinceId: "",
				// 					cityId: "",
				// 					countryId: "",
				// 					road: "",
				// 					buildingCode: "",
				// 					address: "",
				// 					busiName: "",
				//                  accBankNo: "",
				// 					accBankName: "",
				// 					cardNoCipher: "",
				// 					cardName: "",
				// 					picList: [],
				// 					licenceNo:"",
				// 					agree: false
				// 				},
				userInfoRules: {

				},
				isBusiPlaceLists: [{
					name: "是",
					value: '1'
				}, {
					name: "否",
					value: "0"
				}],
				mccCodeLists: [{
						name: "综合零售-各类杂货店、便利店,线下小零售",
						value: "5331"
					},
					{
						name: "餐饮业-快餐店",
						value: "5814"
					},
					{
						name: "居民服务-家政服务",
						value: "7295"
					},
					{
						name: "居民服务-未列入其他代码的个人服务,家教,美甲美容师",
						value: "7299"
					},
					{
						name: "交通运输、物流和仓储服务-出租车服务",
						value: "4121"
					},
					{
						name: "批发商户-其他批发商",
						value: "4121"
					}
				],
				defaultList1: [],
				defaultList2: [],
				defaultList3: [],
				defaultList4: [],
				defaultList5: [],
				defaultList6: [],
				defaultList7: [],
				defaultList8: [],
				defaultList9: [],
				defaultList10: [],
				defaultList11: [],
				defaultList13: [],
				defaultList14: [],
				defaultList15: [],
				defaultList16: [],
				defaultList17: [],
				reportTypeLists: [{
						name: "企业商户",
						value: "00"
					},
					{
						name: "个人商户",
						value: "01"
					}, {
						name: "小微商户",
						value: "02"
					}
				],
				certificateType: '03', //01个人 02企业  03小微
				defaultList: [],
				selectType: "",
				loading: false,
				accBankNameLists: [],
				licenseTypeLists: [{
						name: "多合一营业执照",
						value: "0"
					},
					{
						name: "普通营业执照",
						value: "1"
					},
					{
						name: "无营业执照",
						value: "2"
					}
				],
				legalOccupationLists: [{
						name: "各类专业、技术人员",
						value: "0"
					},
					{
						name: "国家机关、党群组织、企事业单位的负责人",
						value: "1"
					},
					{
						name: "办事人员和有关人员",
						value: "2"
					},
					{
						name: "商业工作人员",
						value: "3"
					},
					{
						name: "服务性工作人员",
						value: "4"
					},
					{
						name: "农林牧渔劳动者",
						value: "5"
					},
					{
						name: "生产工作、运输工作和部分体力劳动者",
						value: "6"
					},
					{
						name: "不便分类的其他劳动者",
						value: "7"
					}
				],
				mccCodeLists: [{
						name: "综合零售-各类杂货店、便利店,线下小零售",
						value: "5331"
					},
					{
						name: "餐饮业-快餐店",
						value: "5814"
					},
					{
						name: "居民服务-家政服务",
						value: "7295"
					},
					{
						name: "居民服务-未列入其他代码的个人服务,家教,美甲美容师",
						value: "7299"
					},
					{
						name: "交通运输、物流和仓储服务-出租车服务",
						value: "4121"
					},
					{
						name: "批发商户-其他批发商",
						value: "4121"
					}
				],
				legalSexLists: [{
					name: "男性",
					value: "1"
				}, {
					name: "女性",
					value: "2"
				}, {
					name: "女性改（变）为男性",
					value: "5"
				}, {
					name: "男性改（变）为女性",
					value: "6"
				}, {
					name: "未说明的性别",
					value: "6"
				}]
			}
		},
		mounted() {
			this.getProvince();
			this.$tools.bk_set_nav_title('进鉴');
			if (this.$route.query.userType != 'userclient') {
				this.reportTypeLists = [{
					name: "小微商户",
					value: "02"
				}]
			}

		},
		computed: {
			uploadImageUrl() {
				return this.$api.POST_UPLOAD_IMG.replace('{id}', this.$route.query.instanceId);
			},
			selectLists() {
				console.log("222", this.selectType)
				let lists = String(this.selectType) + "Lists";
				console.log(this[lists]);
				let dateSlots = [{
					flex: 1,
					values: this[lists],
					className: 'slot1',
					textAlign: 'center'
				}];
				return dateSlots
			}
		},
		watch: {
			"accBankNameLists"() {
				if (this.accBankNameLists.length > 0) {
					this.showPop('accBankName');
				}
			},
			"userInfo.reportType"() {
				if (this.userInfo.reportType == "02") {
					let array = ["006", "0004", "0002", "0003"];
					if (this.userInfo.picList.length > 0) {
						this.userInfo.picList.forEach((ele, index) => {
							if (array.indexOf(ele.type != -1)) {
								this.userInfo.picList.splice(index, 1);
							}
						})
					}
					this.defaultList4 = [];
					this.defaultList5 = [];
					this.defaultList6 = [];
					this.defaultList9 = [];
					this.licenseTypeLists = [{
						name: "无营业执照",
						value: "2"
					}]
				} else {
					this.licenseTypeLists = [{
							name: "多合一营业执照",
							value: "0"
						},
						{
							name: "普通营业执照",
							value: "1"
						},
						{
							name: "无营业执照",
							value: "2"
						}
					]
					let array
					if (this.userInfo.reportType == "00") {
						array = ["0007", "0008", "0016", "0017", "0018", "0019", "0020", "0021"];
						this.defaultList3 = [];
					} else {
						array = ["0008", "0016", "0017", "0018", "0019", "0020", "0021"];
					}
					if (this.userInfo.picList.length > 0) {
						this.userInfo.picList.forEach((ele, index) => {
							if (array.indexOf(ele.type != -1)) {
								this.userInfo.picList.splice(index, 1);
							}
						})
					}
					this.defaultList10 = [];
					this.defaultList11 = [];
					this.defaultList13 = [];
					this.defaultList14 = [];
					this.defaultList15 = [];
					this.defaultList16 = [];
					this.defaultList17 = [];
				}
			}
		},
		methods: {
			getProvince() {
				this.$ajax.get(this, this.$api.GET_PROVINCE_CITY_AREA.replace("{id}", 0) + "?instanceId=" + this.$route.query.instanceId, {},
					(res) => {
						this.provinceIdLists = res.data.content.data;
					});
			},
			gainCityDatas(atg) {
				this.$ajax.get(this, this.$api.GET_PROVINCE_CITY_AREA.replace("{id}", atg) + "?instanceId=" + this.$route.query.instanceId, {},
					(
						res) => {
						this.cityIdLists = res.data.content.data;
						console.log("------22222222222", this.cityIdLists)
					});
			},
			gainAreaDatas(atg) {
				this.$ajax.get(this, this.$api.GET_PROVINCE_CITY_AREA.replace("{id}", atg) + "?instanceId=" + this.$route.query.instanceId, {},
					(
						res) => {
						this.countryIdLists = res.data.content.data;
						console.log("=======", this.countryIdLists)
					});
			},
			bankNameChange() {
				let query = this.userInfo.accBankName;
				if (query !== '') {
					this.loading = true;
					this.$ajax.get(this, this.$api.GET_BANK_LISTS +
						"?instanceId=" + this.$route.query.instanceId + "&cityId=" + this.userInfo.cityId + "&name=" + query, {}, (res) => {
							if (res.code == 200) {
								setTimeout(() => {
									this.loading = false;
									this.accBankNameLists = res.data.content.map(item => {
										return {
											value: item.code,
											name: item.bankBranchName
										};
									});
								}, 200);
							} else {
								this.$messagebox({
									title: '提示',
									message: res.msg
								})
								this.userInfo.accBankName = "";
								this.userInfoRules.accBankNameStatus = "error";
							}
						});
				} else {
					this.accBankNameLists = [];
				}
			},
			formateDate(d) {
				if (String(d).indexOf('-') == -1) {
					let month = (d.getMonth() + 1) < 10 ? "0" + (d.getMonth() + 1) : (d.getMonth() + 1);
					let day = d.getDate() < 10 ? "0" + d.getDate() : d.getDate();
					const newDate = d.getFullYear() + '-' + month + '-' + day;
					return newDate;
				} else {
					return d;
				}
			},
			handleCertificate() {
				let flag = true;
				//是否选择select
				let array = [];
				for (let i in this.currentTags) {
					array.push(i);
				}
				flag = this.userInfo.reportType != "02" && array.length != 6 ? false : true;
				flag = this.userInfo.reportType == "02" && array.length != 11 ? false : true;
				console.log("1", flag, array.length, this.currentTags)
				//是否合法input
				for (let i in this.userInfo) {
					let str = i + "Status";
					this.handleBlur(i);
				}
				for (let i in this.userInfoRules) {
					if (this.userInfoRules[i] === "error") {
						flag = false;
					}
				}
				console.log("2", flag, )
				//是否上传图片0003 0004
				let str = "";
				this.userInfo.picList.forEach(ele => {
					str += ele.type;
				})
				if (this.userInfo.reportType == "00" || this.userInfo.reportType == "01") {
					if (this.userInfo.licenseType == "0") {
						let picCount = this.userInfo.picList.length;
						if (picCount < 6) {
							flag = false;
						} else if (picCount == 6) {
							if (str.indexOf('0003') != -1 || str.indexOf('0004') != -1) {
								flag = false;
							}
						} else if (picCount == 7) {
							if (str.indexOf('0003') != -1 && str.indexOf('0004') != -1) {
								flag = false;
							}
						}
					} else {
						let picCount = this.userInfo.picList.length;
						if (picCount != 8) {
							flag = false;
						}
					}
				} else {
					let testData = [];
					if (this.userInfo.picList.length > 0) {
						this.userInfo.picList.forEach((item, index) => {
							if (this.userInfo.isBusiPlace != "1") {
								if (item.type != "0005" || item.type != "0015") {
									testData.push(item);
								}
							}
						})
					}
					if (this.userInfo.isBusiPlace == "1") {
						let picCount = this.userInfo.picList.length;
						if (picCount < 8) {
							flag = false;
						}
					} else {
						let picCount = testData.length;
						if (picCount < 6) {
							flag = false;
						}
					}
				}
				console.log("3", flag)
				if (flag) {
					if (this.userInfo.agree != true) {
						this.$messagebox({
							title: '提示',
							message: '勾选厦门同安租赁网站注册协议！'
						})
						return;
					}
					this.userInfo.isCompay = this.userInfo.reportType == "02" || this.userInfo.reportType == "01" ? "0" : "1";
					this.userInfo.licenceNo = this.userInfo.reportType == "02" ? "" : this.userInfo.licenceNo;
					this.userInfo.cardDeadline = this.formateDate(this.userInfo.cardDeadline);
					this.userInfo.instanceId = this.$route.query.instanceId;
					this.userInfo.number = this.$route.query.number;
					this.userInfo.client = "app";
					let data = JSON.parse(JSON.stringify(this.userInfo));
					data.picList.forEach((ele, index) => {
						for (let key in ele) {
							let a = "picList[" + index + "]." + key;
							data[a] = ele[key];
						}
					})
					delete data.picList;
					this.$ajax.post(this, this.$api.GET_CHECK, data, (res) => {
						if (res.code == "200") {
							this.$messagebox({
								title: '认证结果',
								message: '认证通过',
								showCancelButton: false,
								confirmButtonText: "确定"
							}).then((res) => {
								if (res === 'confirm') {
									this.getStatus();
									this.$tools.bk_enterprise_authen_success();
								}
							})
						} else {
							this.$messagebox({
								title: '提示',
								message: res.msg
							})
						}
					});
				} else {
					this.$messagebox({
						title: '提示',
						message: '检查*必填项是否合法填写或选择！'
					})
				}

			},
			showContent() {
				this.$messagebox({
					title: "同民安居认证服务协议",
					confirmButtonText: '关闭',
					showCancelButton: false,
					message: "<div class='protocol'><p style='text-align:left;text-indent:20px'>为保障在线支付交易安全，依照中华人民共和国法律、法规以及有关监管政策要求，‘同民安居’平台采用银联商务自助注册签约系统(以下简称自助签约系统)实现在线支付功能，房东在‘同民安居’平台申请开通在线支付功能即视为同步申请银联商务股份有限公司自助签约系统商户。</p><p style='text-align:left;text-indent:20px'>（银联商务股份有限公司是中国银联控股的,专门从事银行卡受理市场建设和提供综合支付服务的机构,成立于2002年12月,总部设在上海市浦东新区。银联商务是首批获得人民银行《支付业务许可证》的支付机构,也是人民银行确定的21家重点支付机构之一。</p><p style='text-align:left;text-indent:20px'>银联商务自助注册签约系统(以下简称自助签约系统)是银联商务面向商户通过互联网平台递交业务开户申请并签订电子服务协议的官方窗口）</p><p style='text-align:left;text-indent:20px'>商户（房东）在自助签约系统申请开通支付受理业务时,需保证提供真实有效的证照材料,按照商户实际属性、名称等准确填写基本信息。在自助注册和签约过程中,自助签约系统所收集的商户证照材料和信息将按照严格的业务规则审核、使用、存储,不用于除业务申请备案和资金结算服务之外的其他用途,也无法通过任何外部系统读取访问。</p><p style='text-align:left;text-indent:20px'>商户（房东）应充分了解:网上自助签约主体的身份是通过对银行结算账户的实名验证结果来判断的,商户与银联商务所签订的电子服务协议等同于纸质协议的法律效力,且签约主体与银行结算账户同名; 房东作为商户自行承担与银联商务往来相应交易手续费，目前手续费率标准约为：0.7%（如有变更以银联商务公告为准）。在协议签订提交之后,银联商务业务部门审核通过,协议即签署成功,即时生效;在自助签约系统上,商户申办的每一项业务对应一份电子协议,一旦签署成功即保留当前版本的协议内容,商户可以登录自助签约系统查看或下载打印协议;当商户希望双方解除协议时,须通过人工客服或向所指定的客户经理提出,并通过人工流程撤销协议。</p></div>"
				})
			},
			getStatus() {
				let datas = {
					instanceId: this.$route.query.instanceId,
					number: this.$route.query.number
				}
				this.$router.push({
					name: "Error",
					query: {
						formdatas: JSON.stringify(datas),
					}
				})
			},
			giveUpCertificate() {
				this.$messagebox({
					title: '是否确认放弃认证',
					message: '<div>未经实名认证，无法线上签署租约、查看租约、支付账单等租中、租后业务</div>',
					showCancelButton: true,
					confirmButtonText: "确认",
					cancelButtonText: "取消"
				}).then(action => {
					if (action == 'confirm') {
						this.$tools.bk_back();
					}
				})
			},
			showPop(query) {
				console.log("ewewew")
				this.popupVisible = true;
				this.selectType = query;
			},
			handleConfirm() {
				debugger;
				this.$forceUpdate();
				this.userInfo[this.selectType] = this.selectType == "provinceId" || this.selectType == "cityId" || this.selectType ==
					"countryId" ? this.$refs[this.selectType].getValues()[0].id : this.$refs[this.selectType].getValues()[0].value;
				this.currentTags[this.selectType] = this.$refs[this.selectType].getValues()[0].name;
				this.popupVisible = false;
				console.log("-=-=-=", this.selectType)
				if (this.selectType == "provinceId") {
					console.log("-=-=-=11111111111111", this.selectType)
					this.cityIdLists = [];
					this.gainCityDatas(this.userInfo[this.selectType]);
				}
				if (this.selectType == "cityId") {
					this.countryIdLists = [];
					this.gainAreaDatas(this.userInfo[this.selectType]);
				}
				if (this.selectType == "accBankName") {
					this.userInfo[this.selectType] = this.$refs[this.selectType].getValues()[0].name;
					this.userInfo.accBankNo = this.accBankNameLists[0].value;
				}
				console.log(this.userInfo)
			},
			handleConfirmDate() {
				this.currentTags.cardDeadline = this.formateDate(this.userInfo.cardDeadline);
			},
			cancelConfirmDate() {
				this.userInfo.cardDeadline = this.formateDate(this.currentTags.cardDeadline);
			},
			showDate() {
				// 如果已经选过日期，则再次打开时间选择器时，日期回显（不需要回显的话可以去掉 这个判断）
				if (this.userInfo.cardDeadline != "" && this.userInfo.cardDeadline != undefined) {
					this.currentTags.cardDeadline = this.userInfo.cardDeadline;
				} else {
					this.currentTags.cardDeadline = this.formateDate(new Date());
					this.userInfo.cardDeadline = this.formateDate(new Date());
				}
				this.$refs['datePicker'].open();
			},
			//上传成功
			uploadComplete(response, filename, type) {
				let index = Number(type.replace('photo', "")) + 1;
				let list = 'defaultList' + index;
				let data = response.data.content;
				let types = "";
				switch (index) {
					case 1:
						types = "0001"
						break;
					case 2:
						types = "0011"
						break;
					case 3:
						types = "0007"
						break;
					case 4:
						types = "0002"
						break;
					case 5:
						types = "0003"
						break;
					case 6:
						types = "0004"
						break;
					case 7:
						types = "0005"
						break;
					case 8:
						types = "0015"
						break;
					case 9:
						types = "0006"
						break;
					case 10:
						types = "0008"
						break;
					case 11:
						types = "0021"
						break;
					case 13:
						types = "0017"
						break;
					case 14:
						types = "0018"
						break;
					case 15:
						types = "0019"
						break;
					case 16:
						types = "0020"
						break;
					case 17:
						types = "0016"
						break;
					default:
						break;
				}
				this[list] = [];
				this[list].push({
					path: data.file_path,
					type: types,
					size: data.file_size
				});
				if (this.userInfo.picList.length > 0) {
					this.userInfo.picList.forEach((item, index) => {
						if (item.type == types) {
							this.userInfo.picList.splice(index, 1);
						}
					})
				}
				this.userInfo.picList.push.apply(this.userInfo.picList, this[list]);
			},
			//删除一张图片
			uploadRemove(item, type) {
				let list = 'defaultList' + (Number(type.replace('photo', "")) + 1);
				this[list].forEach((ele, index) => {
					if (ele.path == item.path) {
						this[list].splice(index, 1);
					}
				});
				this.userInfo.picList.forEach((ele, index) => {
					if (ele.path == item.path) {
						this.userInfo.picList.splice(index, 1);
					}
				});
			},
			handleBlur(query) {
				let str = query + "Status";
				let email = /^(\w+\.?)*\w+@(?:\w+\.)\w+$/;
				let tel = /^1[345789]\d{9}$/;
				let regId = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
				let name = /^[\u4e00-\u9fa5]+$/gi;
				this.$forceUpdate();
				if (this.userInfo[query] == undefined || this.userInfo[query] === "") {
					this.userInfoRules[str] = 'error';
				} else {
					if (query == 'cerdId') {
						this.userInfoRules[str] = !regId.test(this.userInfo[query]) ? 'error' : 'success'
					} else if (query == 'contactPhone') {
						this.userInfoRules[str] = !tel.test(this.userInfo[query]) ? 'error' : 'success'
					} else if (query == 'contactEmail') {
						this.userInfoRules[str] = !email.test(this.userInfo[query]) ? 'error' : 'success'
					} else if (query == 'contactName') {
						this.userInfoRules[str] = !name.test(this.userInfo[query]) ? 'error' : 'success'
					} else {
						this.userInfoRules[str] = 'success';
					}
				}
				if (this.userInfo.reportType == "02" && query == 'licenceNo') {
					this.userInfoRules[str] = 'success';
				}
			}
		}
	}
</script>
<style>

</style>
<style scoped>
	.categoryTitle {
		height: 45px;
		line-height: 55px;
		background: #f7f8fa;
		padding: 0 10px;
		font-size: 14px;
		color: gray;
	}

	.popupClass {
		width: 100%;
	}

	.uploadImg {
		padding: 0 10px;
	}

	.uploadImg p {
		height: 40px;
		line-height: 50px;
	}

	.required {
		color: red;
		display: inline-block;
		margin: 0 2px 0 0;
	}

	.protocol p {
		text-align: left;
		text-indent: 10px;
	}

	.tips {
		margin-top: 20px;
	}

	.slot1 {
		height: 108px;
	}
</style>
